function main() {
    //程序入口
    require(["pluginAttach", "knockout"], function (pluginAttach, ko) {
        ko.components.register("like-widget", {
            viewModel: function (params) {
                this.chosenValue = ko.observable(null);
                // Behaviors
                this.like = function () {
                    this.chosenValue("喜欢");
                }.bind(this);
                this.dislike = function () {
                    this.chosenValue("不喜欢");
                }.bind(this);
            },
            template:
                '<div class="like-or-dislike" data-bind="visible: !chosenValue()">\
                <button data-bind="click: like">喜欢</button>\
                <button data-bind="click: dislike">不喜欢</button>\
                </div>\
                <div class="result" data-bind="visible: chosenValue">\
                你 <strong data-bind="text: chosenValue"></strong> 它\
                </div>',
                });
        ko.applyBindings({}, document.getElementById("root"));
    });
}
require(["../scripts/require.config"], main);
